<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>微信在线投票系统</title>
<link rel="stylesheet" href="css/reset.css"/>
<script src="js/jquery-2.1.1.min.js"></script>


<script type="text/javascript">

$().ready(function(){
	  $.ajax( {
			url : "enterInfoLogin" ,
			type : 'post' ,
			datatype : 'json' , 
			success : function( data ){
				if(data=='00'){
					window.location.href = "phone.html" ;
				}else{
				}					
			} ,
			error : function(){
				alert( '加载失败' );
			}
		});
});

  
  var isSuccess = 1 ;
  
  function nameCheck(){
	  
	  var txt_name = $.trim($("#name").val());
	  if( txt_name.length == 0)
      {   
		  isSuccess = 0 ;
		  $("#errorInfo").text("请输入名字！");
      } else {
    	  isSuccess = 1 ;
      }
  }
  
  function sectionCheck(){
	  var txt_hospital = $.trim($("#section").val() );
	  if( txt_hospital.length == 0){  
		  isSuccess = 0 ;
          $("#errorInfo").text("请输入手机号！");
      }else {
    	  var PHONE_NO_EX = /^1[3|5|7|8|][0-9]{9}$/;   
    	  if(!PHONE_NO_EX.test(txt_hospital)){
    		  isSuccess = 0 ;
    		  $("#errorInfo").text("请输入正确的手机号！");
          }else{
        	  isSuccess = 1 ;
          }
    	  
      }
  }

	function login(){

		console.info( "isSuccess =" + isSuccess );
		
		nameCheck();
		
		if(isSuccess == 0)  
	    {  
	        return false;  
	    }

		console.info( "1 isSuccess =" + isSuccess );
	    	
		sectionCheck();
		
		if(isSuccess == 0)  
	    {  
	        return false;  
	    }
		
			$('#registerID').submit();
	}


	

</script>

</head>	
<body>
<div class="logo"></div>
<div class="tit"></div>
<div class="box">
  <form method="post" action="loginAndRegister" id="registerID">
  	   <!--  1--登录   2--登录注册一体  -->
      <input id="flag" name="flag" type="hidden" placeholder="" value="2"/>
	 <div class="box_input" style="display: none;">
	   <p style="color: #0c60a6">姓名</p>
	   <span><input id="name" name="name" type="hidden" placeholder="" value="test"/></span>
	 </div>
	 <div class="box_input">
	   <p style="color: #0c60a6">电话</p>
	   <span><input id="section" name="section" type="text" placeholder="" /></span>
	 </div>
	 <div class="box_info"><span id="errorInfo"></span></div>
	 <div class="box_submit"><input  type="button" value="登 录"  onclick="login();"/></div>
  </form>
</div>
</body>
</html>
